package com.pan.sign_in.controller;

import com.pan.sign_in.POJO.TO.CallNameTO;
import com.pan.sign_in.POJO.TO.LoginTO;
import com.pan.sign_in.POJO.VO.CallNameDataVO;
import com.pan.sign_in.entity.CallName;
import com.pan.sign_in.entity.Course;
import com.pan.sign_in.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/teacher")
public class TeacherController {
    @Autowired
    private TeacherService teacherService;

    @PostMapping("/login")
    public void Login(@RequestBody LoginTO loginTO){
        teacherService.Login(loginTO);
    }

    @PostMapping("/add_course")
    public void addCourse(@RequestBody Course course){
        teacherService.AddCourse(course);
    }

    @PostMapping("/callname")
    public void CallName(@RequestBody CallNameTO callNameTO){
        teacherService.CallName(callNameTO);
    }

    @PostMapping("/course_callname_record")
    public List<CallName> CourseCallNameRecord(@RequestBody Long cId){
        return teacherService.CourseCallNameRecord(cId);
    }

    @PostMapping("/callname_data")
    public CallNameDataVO CallNameData(@RequestBody Long recordId){
        return teacherService.getCourseCallNameData(recordId);
    }
}
